package com.mayikt.auth.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mayikt.auth.mapper.AccessTokenRecordMapper;
import com.mayikt.auth.mapper.entity.AccessTokenRecord;
import com.mayikt.auth.service.AccessTokenRecordService;
import com.mayikt.base.enums.ApiResponseEnum;
import com.mayikt.exception.BizException;
import org.springframework.stereotype.Service;

@Service
public class AccessTokenRecordServiceImpl extends ServiceImpl<AccessTokenRecordMapper, AccessTokenRecord> implements AccessTokenRecordService {
    @Override
    public int updateAvailableByAppId(Integer available, String appId) {
        if(StrUtil.isEmpty(appId)){
            throw new BizException(ApiResponseEnum.PARAMETER_CAN_NOT_NULL,"appId不能为空");
        }
        if(BeanUtil.isEmpty(available)){
            throw new BizException(ApiResponseEnum.PARAMETER_CAN_NOT_NULL,"available不能为空");
        }
        return this.baseMapper.updateAvailableByAppId(available,appId);
    }
}
